/**
 * 
 */
function selectLocation() {
    if($("#SearchLocation").size() > 0){
        var valueLocation = $("#SearchLocation").val();
        if (valueLocation.length == 0) {
            $('.container_search_location').hide();
            $(".location_check_fix_a").prop('checked', false);
            $(".location_check_fix_a").trigger("change");
        }else{
            $('.container_search_location .location_check_fix_a').not("#container_search_"+valueLocation+" .location_check_fix_a").prop('checked', false);
            $('.container_search_location .location_check_fix_a').not("#container_search_"+valueLocation+" .location_check_fix_a").trigger("change");
            $('.container_search_location').hide();
            $("#container_search_"+valueLocation).show();
        }
    }
}

/**
*
*/
function resizeWindow(){
    var widthWindow = $(window).width();
    if(widthWindow < 1200)
        $('body').width(1200);
    else
        $('body').css('width','100%');
    var home_slider = $("#home_search").width();
    var left = 0;
    if(widthWindow > home_slider){
        left = (widthWindow - home_slider) /2;
    }
    $("#home_search").css({
        'left':left
    });
}

$(document).ready(function() {
    $(".h_navigation > li").on('mouseenter', function() {
        $(this).find(".container_sub_navigation").show();
        $(this).addClass('navi_active');
    }).on('mouseleave', function() {
        $(this).find(".container_sub_navigation").hide();
        $(this).removeClass('navi_active');
    });

    /**
     * 
     */
    selectLocation();
    $("#SearchLocation").on('change', function() {
        selectLocation();
    });
	
    //resize    
    resizeWindow();
    $(window).resize(function() {
        resizeWindow();
    });
    
    //map
    $('.nav-tabs li').on('click',function(){
        setTimeout(function(){
            if($('.show_map').hasClass('active')){
                $('.show_map_content').css({'visibility':'visible','height':'auto'});
            }else{
                $('.show_map_content').css({'visibility':'hidden','height':'10'});
            }
        }, 50);
        
        
    });
    
	
});


